package com.test04_数组;

import org.junit.Test;

/**
 * 数组引用传递
 */
public class YootkDemo_02 {

    @Test
    public void test1() {
        int data[] = new int[]{1, 3, 5};
        int temp[] = data;  // 引用传递
        temp[1] = 90;
        for (int x = 0; x < data.length; x++) {
            System.out.print(data[x] + "、");
        }
    }

    @Test
    public void test2() {
        int data[] = new int[]{1, 3, 5};
        printArray(data);
    }

    // 打印数组内容
    public static void printArray(int temp[]) {
        for (int x = 0; x < temp.length; x++) {
            System.out.print(temp[x] + "、");
        }
        System.out.println();
    }
}
